package ltd.dujiabao.capability.common.exception;

import ltd.dujiabao.capability.common.dto.ErrorCodes;

/**
 * @author : DuJiabao
 * @Project : ddd-capability
 * @Time : 2024/4/7 20:30
 * @Desc :
 */
public class BusinessException extends RuntimeException {

    private final int errorCode;

    public BusinessException(ErrorCodes errorCode) {
        this.errorCode = errorCode.getCode();
    }

    public BusinessException(int errorCode) {
        super();
        this.errorCode = errorCode;
    }

    public BusinessException(String message, int errorCode) {
        super(message);
        this.errorCode = errorCode;
    }

    public BusinessException(String message, Throwable cause, int errorCode) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public BusinessException(Throwable cause, int errorCode) {
        super(cause);
        this.errorCode = errorCode;
    }
}
